def trihyrningsTolur(inntak):
	n = 1
	while n*(n+1)/2 <= inntak:
		n += 1
		if n*(n+1)/2 > inntak:
			k = inntak - (int(n*(n-1)/2))
	return str(n-1) + " " + str(k)
		

oft = int(input())

for x in range(oft):
	tala = int(input())
	print(trihyrningsTolur(tala))
	
